<?php

declare(strict_types=1);

namespace App\CustHub\Model;

use Mine\MineModel;

/**
 * @property int $id 
 * @property int $uid 
 * @property int $main_uid 
 * @property int $config_id 配置ID
 * @property int $robot_id 企微号ID
 * @property string $room_id 群ID
 * @property array $userid 进群用户的ID
 * @property array $invite_data 
 * @property int $status 状态：0=待发送进群申请 1=已发送进群申请 2=进群申请发送成功 3=进群申请发送失败
 * @property string $reason 失败原因
 * @property \Carbon\Carbon $created_at 创建时间
 * @property \Carbon\Carbon $updated_at 更新时间
 * @property-read null|ChRoom $room 
 */
class ChRoomInviteAcceptRecord extends MineModel
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ch_room_invite_accept_record';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'uid', 'main_uid', 'config_id', 'robot_id', 'room_id', 'userid', 'invite_data', 'status', 'reason', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'uid' => 'integer', 'main_uid' => 'integer', 'config_id' => 'integer', 'robot_id' => 'integer', 'userid' => 'array', 'invite_data' => 'array', 'status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];


    public function room(): \Hyperf\Database\Model\Relations\HasOne
    {
        return $this->hasOne(ChRoom::class, 'room_wxid', 'room_id');
    }
}
